



#配置
#进行Celery允许配置
# 为celery使用django配置文件进行设置
import os
if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'mall.settings'


from celery import Celery
# 1创建XX对象
app=Celery('celery_tasks')


#2设置broker
# config_from_object 设置配置文件路径
app.config_from_object('celery_tasks.config')

#3自动检测任务

app.autodiscover_tasks(['celery_tasks.sms','celery_tasks.email','celery_tasks.html'])

# 虚拟环境中运行
# celery -A celery_tasks.main worker -l info